<!DOCTYPE html>
<html lang="en" style="height: 100%;">
<head>
    <meta charset="UTF-8">
    <title>订单管理</title>
    <style>
        .hander_zx{font-size:18px}.conten{background:#fff;margin-top:10px}.conten ul{overflow:hidden;padding:0;margin:0;border-bottom:1px solid #e5e5e5}.conten_floet li{float:left;list-style:none;line-height:45px;text-align:center;width:100px;cursor:pointer;color:#212121}.active{color:#14d882!important;border-bottom:3px solid #14d882}.push_fx li{float:left;font-size:14px;list-style:none;width:10%;text-align:center;background:#f8f8f8;line-height:45px;color:#1f1f1f}.lick_push li{float:left;font-size:14px;width:10%;text-align:center;line-height:45px;list-style:none;color:#616161}.lick_push li:last-child{color:#14d882!important}.lick_push li:last-child span:nth-child(1){margin-right:5px}.lick_push li:last-child span{cursor:pointer}.w_node{width:14%!important}
        .im_sc{margin-top:10px;margin-bottom:10px;position:relative}.im_sc img{cursor:pointer;width:145px;margin-left:10px}.im_sc ul{position:absolute;right:0;top:0;border:none!important}.im_sc li{float:left;list-style:none;line-height:35px;padding:0 15px;border:1px solid #14d882;margin-right:10px;font-size:14px;border-radius:7px;color:#14d882;margin-top:2px;cursor:pointer}.img_push{height:45px}.img_push img{margin-top:3px;width: 48px;height: 37px;}.input_fx{position:relative;margin-left:-30px;margin-right:10px}#ny_dd_posh{display:none}.push_fx li:nth-child(1),.push_fx li:nth-child(2){width:8%!important}.lick_push li:nth-child(1),.lick_push li:nth-child(2){width:8%!important}.lick_push li:nth-child(3),.push_fx li:nth-child(3){width:20%!important}
    </style>
    <link rel="stylesheet" href="../css/paging.css">
</head>
<body style="height:100%;overflow-x: hidden">
<!--//hander-->
<div class="hander_zx" style="padding: 5px 0 0 10px;">订单管理</div>
<!--内容-->
<div class="conten">
    <ul class="conten_floet">
        <li class="active product">商品</li>
        <li class="product" style="display: none">认养产品</li>
    </ul>
    <!--//商品订单管理列表-->
    <div id="fx_dd_posh">
        <div class="im_sc">
            <img src="../img/ddgl.png" alt="" class="Release">
            <ul>
                <li class="sp_shelves">上架</li>
                <li class="sp_shelf">下架</li>
                <li class="sp_Add">添加到主页</li>
                <li class="sp_lower">取消到主页</li>
                <li class="sp_delete">删除</li>
            </ul>
        </div>
        <div>
            <ul class="push_fx" style="background:#F8F8F8;width: 100%;">
                <li>排序</li>
                <li>图片</li>
                <li class="w_node">商品名称</li>
                <li>价格</li>
                <li>库存</li>
                <li>位置</li>
                <li>状态</li>
                <li class="w_node">上架时间</li>
                <li>操作</li>
            </ul>
        </div>
        <div id="commodity">
        </div>
    </div>
    <!--认养订单管理列表-->
    <div id="ny_dd_posh">
        <div class="im_sc">
            <img src="../img/ddgl.png" alt="">
            <ul>
                <li class="ry_shelves">上架</li>
                <li class="ry_shelf">下架</li>
                <li class="ry_Add">添加到主页</li>
                <!--<li class="ry_lower">取消到主页</li>-->
                <li class="ry_delete">删除</li>
            </ul>
        </div>
        <div>
            <ul class="push_fx" style="background:#F8F8F8;width: 100%;">
                <li>排序</li>
                <li>产品图片</li>
                <li class="w_node">产品名称</li>
                <li>单价</li>
                <li>年化率</li>
                <li>认养周期</li>
                <li>位置</li>
                <li class="w_node">上架时间</li>
                <li>操作</li>
            </ul>
        </div>
        <div class="push_ry">
        </div>
    </div>
    <div class="box" id="box" style="display:block;"></div>
</div>
</body>
<script src="https://cdn.bootcss.com/jquery/2.1.1-rc2/jquery.min.js"></script>
<script src="../js/paging.min.js"></script>
<!--//订单管理 商品订单-->
<script>
    "use strict";$(function(){function formatDate(now){var now=new Date(now);var year=now.getFullYear();var month=now.getMonth()+1;var date=now.getDate();var hour=now.getHours();var minute=now.getMinutes();var second=now.getSeconds();return year+"-"+fixZero(month,2)+"-"+fixZero(date,2)+" "+fixZero(hour,2)+":"+fixZero(minute,2)+":"+fixZero(second,2)}function fixZero(num,length){var str=""+num;var len=str.length;var s="";for(var i=length;i-->len;){s+="0"}return s+str}$(".product").on('click',function(){if(typeof $(this).text()==="string"&&$(this).text()!==null){$(this).siblings().removeClass("active");$(this).addClass("active");if($(this).text()==="商品"){$("#fx_dd_posh").css("display","block");$("#ny_dd_posh").css("display","none");commodity();return}if($(this).text()==="认养产品"){$("#ny_dd_posh").css("display","block");$("#fx_dd_posh").css("display","none");ry();return}}});function commodity(){$.ajax({type:'get',url:'/saleproduct/selectallproductnum',dataType:'json',contentType:"application/json",success:function success(data){c(data,'/saleproduct/selectallproduct')}});function c(data,url_to){if(typeof data.data==='number'&&data.data>0){$("#box").css("display","block")}else{$("#box").css("display","none")}var total=Math.ceil(data.data/24);$('#box').paging({initPageNo:1,totalPages:total,totalCount:'合计'+data.data+'条数据',slideSpeed:600,jump:true,callback:function callback(page){$.ajax({type:'post',url:url_to,dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({currentPage:page,pageCount:24}),success:function success(data){var html='';for(var i=0;i<data.data.length;i++){html+="\n                                    <ul class=\"lick_push\">\n                                        <li>\n                                            <input type=\"checkbox\" class=\"input_fx\" value=\""+data.data[i].id+"\" name=\"goods\">\n                                            <span>"+(i+1)+"</span>\n                                        </li>\n                                        <li>\n                                            <div class=\"img_push\">\n                                                <img src=\""+data.data[i].photo_url+"\" alt=\"\">\n                                            </div>\n                                        </li>\n                                        <li class=\"w_node\">"+data.data[i].name+"</li>\n                                        <li>"+data.data[i].price+"</li>\n                                        <li>"+data.data[i].lave_amount+"</li>\n                                        <li>"+(data.data[i].ishome==1?"首页":"列表")+"</li>\n                                        <li>"+(data.data[i].state==0?"未发布":data.data[i].state==1?"已上架":"已下架")+"</li>\n                                        <li class=\"w_node\">"+formatDate(data.data[i].publish_time)+"</li>\n                                        <li>\n                                            <span class=\"comm_fh\" id=\"sp_edit\" data-idpush=\""+data.data[i].id+"\">\u7F16\u8F91</span>\n                                            <!--<span class=\"comm_ck\">\u6DFB\u52A0\u89C4\u683C</span>-->\n                                        </li>\n                                    </ul>\n                                    "}$("#commodity").html(html)}})}})}$(".sp_shelves").on('click',function(){Big_public("请选择需要上架的商品","/saleproduct/updateproductstateup","上架成功")});$(".sp_shelf").on('click',function(){Big_public("请选择需要下架的商品","/saleproduct/updateproductstatedown","下架成功")});$(".sp_Add").on('click',function(){Big_public("请选择添加到主页的商品","/saleproduct/updateproishomeup","添加成功")});$(".sp_lower").on('click',function(){Big_public("请选择取消到主页的商品","/saleproduct/updateproishomedown","取消成功")});$(".sp_delete").on('click',function(){Big_public("请选择需要删除的商品","/saleproduct/updateprodeltag","删除成功")});function Big_public(a,b,c){var number='';$('.input_fx:checkbox[name=goods]:checked').each(function(k){if(k==0){number=$(this).val()}else{number+=','+$(this).val()}});if(number.length<=0){alert(a);return}if(number.length>0){$.ajax({type:'post',url:b,dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({ids:number}),success:function success(data){if(data.code=="00"){alert(c);location.reload();return}if(data.code!="00"){alert(data.data);return}}})}}}commodity();function ry(){$.ajax({type:'post',url:'/getInvestProductList',dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({currentPage:1,pageCount:24}),success:function success(data){w(data,'/getInvestProductList')}});function w(data,url_to){if(typeof data.totalCount==='number'&&data.totalCount>0){$("#box").css("display","block")}else{$("#box").css("display","none")}var total=Math.ceil(data.totalCount/24);$('#box').paging({initPageNo:1,totalPages:total,totalCount:'合计'+data.totalCount+'条数据',slideSpeed:600,jump:true,callback:function callback(page){$.ajax({type:'post',url:url_to,dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({currentPage:page,pageCount:24}),success:function success(data){var html='';for(var i=0;i<data.rows.length;i++){html+="\n                                    <ul class=\"lick_push\">\n                                        <li>\n                                            <input type=\"checkbox\" class=\"input_fx_pk\" value=\""+data.rows[i].id+"\" name=\"good\">\n                                            <span>"+(i+1)+"</span>\n                                        </li>\n                                        <li>\n                                            <div class=\"img_push\">\n                                                <img src=\""+data.rows[i].photo_url+"\" alt=\"\">\n                                            </div>\n                                        </li>\n                                        <li class=\"w_node\">"+data.rows[i].sub_title+"</li>\n                                        <li>"+data.rows[i].price+"</li>\n                                        <li>"+(data.rows[i].return_rate+"%")+"</li>\n                                        <li>"+(data.rows[i].time_limit+"月")+"</li>\n                                        <li>"+(data.rows[i].state==0?"未发布":data.rows[i].state==1?"已上架":"已下架")+"</li>\n                                        <li class=\"w_node\">"+formatDate(data.rows[i].publish_time)+"</li>\n                                        <li>\n                                            <span class=\"comm_fh\">\u7F16\u8F91</span>\n                                        </li>\n                                    </ul>\n                                    "}$(".push_ry").html(html)}})}})}$(".ry_shelves").on('click',function(){Big_public("请选择需要上架的商品","/upsale","上架成功",1)});$(".ry_shelf").on('click',function(){Big_public("请选择需要下架的商品","/upsale","下架成功",2)});$(".ry_Add").on('click',function(){Big_public("请选择添加到主页的商品","/sethome","添加成功",null)});$(".ry_delete").on('click',function(){Big_public("请选择需要删除的商品","/delInvest","删除成功",null)});function Big_public(a,b,c,d){var number='';$('.input_fx_pk:checkbox[name=good]:checked').each(function(k){if(k==0){number=$(this).val()}else{number+=','+$(this).val()}});if(number.length<=0){alert(a);return}if(number.length>0){$.ajax({type:'post',url:b,dataType:'json',contentType:"application/json",async:false,data:JSON.stringify({idList:number,state:d}),success:function success(data){if(data.code=="code"){alert(c);location.reload();return}if(data.code!="00"){alert(data.data);return}}})}}};$(".Release").on('click',function(){window.sessionStorage.setItem("padWhether","1");location.href="release.html"});$("#commodity").on('click','#sp_edit',function(){window.sessionStorage.setItem("padWhether","2");window.sessionStorage.setItem("id",$(this).attr("data-idpush"));location.href="release.html"})});
</script>
</html>